package com.heima.user;

import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author XHui
 * @Since 2024/2/6 10:31
 * @Version 1.0
 */
public class AIYongyou {

    @Test
    void idCardTest() {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.set("apicode", "84fe7b55fbe24a05803697235c0480db");

        // 请求参数
        Map<String , String> paramMap = new HashMap<>();
        paramMap.put("idNumber", "210103195103222113");
        paramMap.put("userName", "王东镇");

        HttpEntity<String> entity = new HttpEntity<>(JSON.toJSONString(paramMap), headers);
        ResponseEntity<String> responseEntity = restTemplate.postForEntity("https://api.yonyoucloud.com/apis/dst/matchIdentity/matchIdentity", entity, String.class);
        System.out.println(responseEntity);

    }
}
